public abstract class SortedTree<Element extends Comparable> extends Tree<Element> {
	
	public SortedTree(Element element) {
		super(element);
	}
	
	public SortedTree() {
		super();
	}
	
	@Override
	public TreeIter contains(Element element) {
//		return this.recSearch(element, root);
		return null;
	}
	
	//Nicht contains, sondern add muss bei unserer variante entsprechen überschrieben werden, also gar nicht hier ausgefüllt sein
	@Override
	public void add(Element element) {
		if (this.root != null) {
			recAdd(element, root);
		} else {
			this.root = new Node(element);
		}
	}
	
	protected abstract void recAdd(Element newElement, Node currentNode);
	
	protected Node goToLast() {
		if(super.root != null) {
			Node tempNode = super.root;
			while(tempNode.getNext() != null) {
				tempNode = tempNode.getNext();
			}
			return tempNode;
		} else {
			return null;
		}
	}
	
	@Override
	public Iter<Boolean> search(Element element) {
		Node currentNode = root;
		Node boolStartNode;
		Node boolNode;
		
		if (currentNode == null) {
			return null;
		}
		if (element.equals(currentNode.getElement())) {
			return new Iterator<Boolean>(null);
		}
		if (element.compareTo(currentNode.getElement()) < 0) {
			boolStartNode = new Node((Boolean)false);
			currentNode = currentNode.getLeft();
		} else {
			boolStartNode = new Node((Boolean)true);
			currentNode = currentNode.getRight();
		}
		boolNode = boolStartNode;
		while (!currentNode.getElement().equals(element)) {
			if (currentNode == null) {
				return null;
			} else if (element.compareTo(currentNode.getElement()) < 0) {
				currentNode = currentNode.getLeft();
				boolNode.setNext(new Node((Boolean) false));
				boolNode.getNext().setPrevious(boolNode);
				boolNode = boolNode.getNext();
			} else if (element.compareTo(currentNode.getElement()) > 0) {
				currentNode = currentNode.getRight();
				boolNode.setNext(new Node((Boolean) true));
				boolNode.getNext().setPrevious(boolNode);
				boolNode = boolNode.getNext();
			}
		}
		return new Iterator<Boolean>(boolStartNode);
	}
}
